package com.yumijinfu.dialog;

import android.app.Dialog;
import android.content.Context;
import android.widget.TextView;

import com.yumijinfu.R;

/**
 * Created by ekikousei易皇星 on 16/11/23.
 * E-mail:13764664731@163.com
 * Signature:缘分是本书,翻的不经意会错过,读的太认真会流泪!!
 * <p>
 * TODO:类描述:   网络请求加载对话框
 */
public class LoadingDialog extends Dialog {

    private TextView loadingText;
    private Context context;
    private static LoadingDialog loadingDialog;

    public LoadingDialog(Context context) {
        super(context,R.style.LoadingDialogStyle);
        this.context=context;
        init();

    }


    public static  LoadingDialog getInstance(Context context){

        if(loadingDialog==null){
            //走构造方法
            loadingDialog=new LoadingDialog(context);
        }

        return  loadingDialog;


    }



    public LoadingDialog(Context context, int themeResId) {
        super(context, themeResId);
        this.context=context;
        init();
    }


    private void init() {
        setContentView(R.layout.loading_dialag_layout);
        loadingText = (TextView) findViewById(R.id.tv_loading_text);

    }

    /**
     * @param loadingtext 设置加载提示语
     */
    public void setLoadingText(String loadingtext) {
        if (null != loadingText) {
            loadingText.setText(loadingtext);
        }

    }


}
